package com.tadpole.music.adapter.home;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.ViewGroup;

import androidx.annotation.NonNull;

import com.tadpole.music.R;
import com.tadpole.music.adapter.base.BaseAdapter;
import com.tadpole.music.bean.home.NewInfoListBean;
import com.tadpole.music.holder.base.BaseViewHolder;
import com.tadpole.music.holder.home.NewInfoListViewHolder;

import java.util.List;


/**
 * 通知公告列表
 * Created By 孙岩
 * on 2020/12/5
 */
public class NewInfoListAdapter extends BaseAdapter {
    private Activity activity;
    private NewInfoListViewHolder newInfoListViewHolder;
    private OnItemClickListener onItemClickListener;
    private List<NewInfoListBean.DataBeanX.DataBean> list;
    public NewInfoListAdapter(Activity activity,List<NewInfoListBean.DataBeanX.DataBean> list){
        this.activity = activity;
        this.list = list;
    }
    @Override
    public BaseViewHolder createRelHolder(ViewGroup parent, int viewType) {
        newInfoListViewHolder = new NewInfoListViewHolder(activity, LayoutInflater.from(activity).inflate(R.layout.item_new_info_list, parent, false),onItemClickListener,list);
        return newInfoListViewHolder;
    }

    @Override
    public int getRelItemCount() {
        return list.size();
    }

    @Override
    public void setOnItemClickListener(OnItemClickListener listener) {
        this.onItemClickListener = listener;
    }

    @Override
    public void setOnChildClickListener(OnChildClickListener listener) {

    }

    @Override
    public void setOnLongClickListener(OnLongClickListener listener) {

    }

    @Override
    public void onBindViewHolder(@NonNull BaseViewHolder holder, int position) {
        holder.init(position - mHeadViews.size());
    }
}
